sgdk: vdp_pal.h File Reference

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Classes | Defines | Functions | Variables
vdp_pal.h File Reference

VDP Palette support. More...

Go to the source code of this file.

## Classes

struct | Palette

## Defines

#define | VDPPALETTE_REDSFT 9
#define | VDPPALETTE_GREENSFT 5
#define | VDPPALETTE_BLUESFT 1
#define | VDPPALETTE_REDMASK 0x0E00
#define | VDPPALETTE_GREENMASK 0x00E0
#define | VDPPALETTE_BLUEMASK 0x000E
#define | VDPPALETTE_COLORMASK 0x0EEE
#define | RGB24_TO_VDPCOLOR(color) (((color >> ((2 * 4) + 4)) & VDPPALETTE_REDMASK) | ((color >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((color >> ((0 * 4) + 4)) & VDPPALETTE_BLUEMASK))

## Functions

u16 | VDP_getPaletteColor (u16 index)
| Returns RGB color of specified palette entry.
void | VDP_getPaletteColors (u16 index, u16 *dest, u16 count)
| Read count RGB colors from specified index and store them in specified palette.
void | VDP_getPalette (u16 index, u16 *pal)
| Get palette.
void | VDP_setPaletteColor (u16 index, u16 value)
| Set RGB color to specified palette entry.
void | VDP_setPaletteColors (u16 index, u16 *values, u16 count)
| Set RGB colors to specified palette entries.
void | VDP_setPalette (u16 num, const u16 *pal)
| Set palette.
u16 | VDP_doStepFading (u16 waitVSync)
u16 | VDP_initFading (u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe, u16 waitVSync)
void | VDP_interruptFade ()
| Interrupt any asynchronous palette fading effect.
void | VDP_fade (u16 fromcol, u16 tocol, const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async)
| General palette fading effect.
void | VDP_fadeTo (u16 fromcol, u16 tocol, const u16 *pal, u16 numframe, u8 async)
| Fade current color palette to specified one.
void | VDP_fadeOut (u16 fromcol, u16 tocol, u16 numframe, u8 async)
| Fade out (current color to black) effect.
void | VDP_fadeIn (u16 fromcol, u16 tocol, const u16 *pal, u16 numframe, u8 async)
| Fade in (black to specified color) effect.
void | VDP_fadePal (u16 numpal, const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async)
| Do palette fade effect.
void | VDP_fadePalTo (u16 numpal, const u16 *pal, u16 numframe, u8 async)
| Fade current palette to specified one.
void | VDP_fadePalOut (u16 numpal, u16 numframe, u8 async)
| Fade out (current color to black) effect.
void | VDP_fadePalIn (u16 numpal, const u16 *pal, u16 numframe, u8 async)
| Fade in (black to specified color) effect.
void | VDP_fadeAll (const u16 *palsrc, const u16 *paldst, u16 numframe, u8 async)
| Global palette fading effect.
void | VDP_fadeAllTo (const u16 *pal, u16 numframe, u8 async)
| Palettes fade to specified one.
void | VDP_fadeOutAll (u16 numframe, u8 async)
| Fade out (current color to black) effect.
void | VDP_fadeInAll (const u16 *pal, u16 numframe, u8 async)
| Fade in (black to specified color) effect.
u16 | VDP_isDoingFade ()
| Returns TRUE if currently doing a asynchronous fade operation.
void | VDP_waitFadeCompletion ()
| Wait for palette fading operation to complete (for asynchrone fading).

## Variables

const u16 *const | palette_black
| Default black palette.
const u16 | palette_grey [16]
| Default grey palette.
const u16 | palette_red [16]
| Default red palette.
const u16 | palette_green [16]
| Default green palette.
const u16 | palette_blue [16]
| Default blue palette.

## Detailed Description

VDP Palette support.

Author:
  Stephane Dallongeville

Date:
  08/2011

This unit provides methods to manipulate the VDP Color Palette.
The Sega Genesis VDP has 4 palettes of 16 colors.
Color is defined with 3 bits for each component : 0RRR00GGG00BBB00

## Define Documentation

#define RGB24_TO_VDPCOLOR | ( |  | color | ) | (((color >> ((2 * 4) + 4)) & VDPPALETTE_REDMASK) | ((color >> ((1 * 4) + 4)) & VDPPALETTE_GREENMASK) | ((color >> ((0 * 4) + 4)) & VDPPALETTE_BLUEMASK))

Convert a RGB 24 bits color to VDP color

Parameters:

  color | RGB 24 bits color

## Function Documentation

void VDP_fade | ( | u16 | fromcol,
|  | u16 | tocol,
|  | const u16 * | palsrc,
|  | const u16 * | paldst,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

General palette fading effect.

Parameters:

  fromcol | Start color index for the fade effect (0-63).
  tocol | End color index for the fade effect (0-63 and >= fromcol).
  palsrc | Fade departure palette.
  paldst | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

This function does general palette fading effect.
The fade operation is done to all palette entries between 'fromcol' and 'tocol'.
Example: fading to all palette entries --> fromcol = 0 and tocol = 63

void VDP_fadeAll | ( | const u16 * | palsrc,
|  | const u16 * | paldst,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Global palette fading effect.

Parameters:

  palsrc | Fade departure palette (should contains 64 colors entries).
  paldst | Fade arrival palette (should contains 64 colors entries).
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

The fade operation is done to all palette entries.

void VDP_fadeAllTo | ( | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Palettes fade to specified one.

Parameters:

  pal | Fade arrival palette (should contains 64 entries).
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

The fade operation is done to all palette entries.
See VDP_fadeAll().

void VDP_fadeIn | ( | u16 | fromcol,
|  | u16 | tocol,
|  | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade in (black to specified color) effect.

Parameters:

  fromcol | Start color index for the fade operation (0-63).
  tocol | End color index for the fade operation (0-63 and >= fromcol).
  pal | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fade() for more informations.

void VDP_fadeInAll | ( | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade in (black to specified color) effect.

Parameters:

  pal | Fade arrival palette (should contains 64 entries).
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

The fade operation is done to all palette entries.
See VDP_fadeAll().

void VDP_fadeOut | ( | u16 | fromcol,
|  | u16 | tocol,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade out (current color to black) effect.

Parameters:

  fromcol | Start color index for the fade operation (0-63).
  tocol | End color index for the fade operation (0-63 and >= fromcol).
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fade() for more informations.

void VDP_fadeOutAll | ( | u16 | numframe,
|  | u8 | async
| ) |  |

Fade out (current color to black) effect.

Parameters:

  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

The fade operation is done to all palette entries.
See VDP_fadeAll().

void VDP_fadePal | ( | u16 | numpal,
|  | const u16 * | palsrc,
|  | const u16 * | paldst,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Do palette fade effect.

Parameters:

  numpal | Palette number to use for fade effect.
  palsrc | Fade departure palette.
  paldst | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

The fade operation is done to all specified palette entries.
See VDP_fade() for more informations.

void VDP_fadePalIn | ( | u16 | numpal,
|  | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade in (black to specified color) effect.

Parameters:

  numpal | Palette to fade.
  pal | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fadePal() for more informations.

void VDP_fadePalOut | ( | u16 | numpal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade out (current color to black) effect.

Parameters:

  numpal | Palette to fade.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fadePal() for more informations.

void VDP_fadePalTo | ( | u16 | numpal,
|  | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade current palette to specified one.

Parameters:

  numpal | Palette to fade.
  pal | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fadePal() for more informations.

void VDP_fadeTo | ( | u16 | fromcol,
|  | u16 | tocol,
|  | const u16 * | pal,
|  | u16 | numframe,
|  | u8 | async
| ) |  |

Fade current color palette to specified one.

Parameters:

  fromcol | Start color index for the fade operation (0-63).
  tocol | End color index for the fade operation (0-63 and >= fromcol).
  pal | Fade arrival palette.
  numframe | Duration of palette fading in number of frame.
  async | Async process. If set the function return immediatly else the function wait for fading to complete.

See VDP_fade() for more informations.

void VDP_getPalette | ( | u16 | index,
|  | u16 * | pal
| ) |  |

Get palette.

Parameters:

  index | Palette index (0-3).
  pal | Destination where to copy palette (should be 16 words long at least)

u16 VDP_getPaletteColor | ( | u16 | index | ) |

Returns RGB color of specified palette entry.

Parameters:

  index | Color index (0-63).

Returns:
  RGB intensity for the specified color index.

void VDP_getPaletteColors | ( | u16 | index,
|  | u16 * | dest,
|  | u16 | count
| ) |  |

Read count RGB colors from specified index and store them in specified palette.

Parameters:

  index | Color index where start to read (0-63).
  dest | Destination palette where to write read RGB intensities.
  count | Number of color to get.

void VDP_setPalette | ( | u16 | num,
|  | const u16 * | pal
| ) |  |

Set palette.

Parameters:

  num | Palette number (0-3).
  pal | Source palette.

void VDP_setPaletteColor | ( | u16 | index,
|  | u16 | value
| ) |  |

Set RGB color to specified palette entry.

Parameters:

  index | Color index to set (0-63).
  value | RGB intensity to set in the specified color index.

void VDP_setPaletteColors | ( | u16 | index,
|  | u16 * | values,
|  | u16 | count
| ) |  |

Set RGB colors to specified palette entries.

Parameters:

  index | Color index where to start to write (0-63).
  values | RGB intensities to set.
  count | Number of color to set.

All Classes Files Functions Variables Typedefs Enumerations Defines